package com.ruibang.glass.produce.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruibang.glass.produce.domain.req.ProductLineReq;
import com.ruibang.glass.produce.entity.ProductLine;
import com.ruibang.glass.produce.mapper.ProductLineMapper;
import com.ruibang.glass.produce.service.ProductLineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2023-11-15  19:10
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Service
public class ProductLineImpl extends ServiceImpl<ProductLineMapper, ProductLine> implements ProductLineService {


    @Override
    public Page<ProductLine> queryProductLine(ProductLineReq productLineReq) {
        return baseMapper.queryProductLine(new Page<>(productLineReq.getPageNo(), productLineReq.getPageSize()), productLineReq);
    }


    @Override
    public List<ProductLine> getProductLineList(String workshopId) {
        if (StringUtils.isNotBlank(workshopId)) {
            return lambdaQuery().eq(ProductLine::getWorkshopId, workshopId).orderByAsc(ProductLine::getSort).list();
        }
        return lambdaQuery().list();
    }




}
